package com.mazaiting.classfile.attr.info;

import com.mazaiting.classfile.ClassReader;
import com.mazaiting.classfile.constant.ConstantPool;

import java.util.Arrays;

/**
 * 不能解析的属性
 *
 * @author mazaiting
 * @since 2021/8/12
 */
public class UnparsedAttribute extends AttributeInfo {
    /**
     * 名称
     */
    private final String name;
    /**
     * 字节内容
     */
    private byte[] bytes;

    public UnparsedAttribute(String name, ConstantPool pool, int index, int length) {
        super(pool, index, length);
        this.name = name;
    }

    @Override
    public void readInfo(ClassReader reader) {
        this.bytes = reader.readBytes(length);
    }

    @Override
    public String toString() {
        return "UnparsedAttribute{" +
                "name='" + name + '\'' +
                ", length=" + length +
                ", bytes=" + Arrays.toString(bytes) +
                '}';
    }
}


















